
public class MyProgram {
    public static void main(String[] args) {
        System.out.println(5 / 2);//2
        System.out.println(5.0 / 2);//2.5
        System.out.println((float) 5 / 2);//2.5
        System.out.println((float) (5 / 2));//2.0

        //System.out.println(5/0); err,0不能做除数
        //Exception in thread "main" java.lang.ArithmeticException: / by zero

        System.out.println(10 % 3);//1
        System.out.println(-10 % 3);//-1
        System.out.println(10 % -3);//1
        System.out.println(-10 % -3);//-1
        //注：Java中%的操作数可以是浮点数
        System.out.println(6.9 % 2.1);
        float a = 6.9f;
        float b = 2.1f;
        System.out.println(a % b);
    }
}
